home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / share / ewl / examples / ewl_calendar_test.c < prev    next >
C/C++ Source or Header  |  2006-01-09  |  2KB  |  67 lines

  1. #include "ewl_test.h"
  2.  
  3. Ewl_Widget* cal;
  4. Ewl_Widget* calendar_win;
  5. Ewl_Widget *calendar_button;
  6.  
  7. void
  8.  __destroy_calendar_test_window(Ewl_Widget *w, void *ev_data __UNUSED__, void *user_data __UNUSED__)
  9.  {
  10.         ewl_widget_destroy(w);
  11.         ewl_callback_append(calendar_button, EWL_CALLBACK_CLICKED,
  12.                             __create_calendar_test_window, NULL);
  13.  
  14.  
  15.         return;
  16.  }
  17.  
  18. void
  19. ewl_calendar_test(Ewl_Widget *main_win __UNUSED__, void *ev_data __UNUSED__, void *user_data)
  20.  {
  21.      char *date;
  22.  
  23.      date = ewl_calendar_ascii_time_get(EWL_CALENDAR(user_data));
  24.      printf ("Selected: %s\n", date);
  25.      free(date);
  26.  }
  27.  
  28.  
  29. void
  30. __create_calendar_test_window(Ewl_Widget * w, void *ev_data __UNUSED__,
  31.                                         void *user_data __UNUSED__)
  32. {
  33.         calendar_button = w;
  34.     
  35.         calendar_win= ewl_window_new();
  36.         
  37.         ewl_window_title_set(EWL_WINDOW(calendar_win), "Calendar");
  38.         ewl_window_name_set(EWL_WINDOW(calendar_win), "Calendar");
  39.         ewl_window_class_set(EWL_WINDOW(calendar_win), "Calendar");
  40.         ewl_object_size_request(EWL_OBJECT(calendar_win), 159,160);
  41.  
  42.         if (w) {
  43.                     ewl_callback_del(w, EWL_CALLBACK_CLICKED,
  44.                                         __create_calendar_test_window);
  45.                     ewl_callback_append(calendar_win, EWL_CALLBACK_DELETE_WINDOW,
  46.                                     __destroy_calendar_test_window, NULL);
  47.             } else
  48.                     ewl_callback_append(calendar_win, EWL_CALLBACK_DELETE_WINDOW,
  49.                                         __close_main_window, NULL);
  50.  
  51.  
  52.         
  53.         cal = ewl_calendar_new();
  54.  
  55.  
  56.         ewl_object_fill_policy_set(EWL_OBJECT(calendar_win), EWL_FLAG_FILL_ALL);
  57.         ewl_container_child_append(EWL_CONTAINER(calendar_win), cal);
  58.         
  59.         ewl_widget_show(calendar_win);
  60.         ewl_widget_show(cal);
  61.  
  62.  
  63.         ewl_callback_append(EWL_WIDGET(cal), EWL_CALLBACK_VALUE_CHANGED,ewl_calendar_test, cal);
  64.  
  65.  
  66. }
  67.